#include <iostream>
using namespace std;
//单例模式

class Singleton
{
private:
    static Singleton s;
    int i;
    Singleton(int x):i(x){}
    Singleton(const Singleton&) = delete;            // 禁用拷贝构造
    Singleton& operator=(const Singleton&) = delete; // 禁用拷贝赋值
public:
    static Singleton& instance(){
        return s;
    }

    int getValue(){
        return i;
    }
    void setValue(int value){
        i=value;
    }
};

Singleton Singleton::s(12);

int main(){
    Singleton& s =Singleton::instance();
    cout << s.getValue() <<endl;
    s.setValue(13);
    cout << s.getValue() <<endl;
}

